/**
 * Copyright 2009 University of Washington This code is released under the GPL version 3 - with a copy of the license
 * included
 * 
 * @author Maya Hao Li
 * 
 */
package seedpod.webapp.view;

import seedpod.model.AVPair;
import seedpod.webapp.view.seedpodwidgets.LimsWidget;
import seedpod.webapp.view.seedpodwidgets.LimsWidgetFactory;

@Deprecated
public class AVRenderer {

	private AVPair _avPair;

	public AVRenderer(AVPair avPair) {
		_avPair = avPair;
	}

	public String doEdit() {
		String formWidgetName = _avPair.getAttribute().getFormWidget();
		LimsWidget widget = LimsWidgetFactory.getWidget( formWidgetName, _avPair );
		widget.setData( _avPair.getValue() );
		widget.setId( _avPair.genRefId() );
		return widget.render();
	}

	public String doView() {
		String viewWidgetName = _avPair.getAttribute().getViewWidget();
		LimsWidget widget = LimsWidgetFactory.getWidget( viewWidgetName, _avPair );
		widget.setData( _avPair.getValue() );
		widget.setId( _avPair.genRefId() );
		return widget.render();
	}

}
